package com.xiaoxi.decoratormode.display;

/**
 * @Author xiaoxi
 * @ProjectName design_mode
 * @PackageName com.xiaoxi.decoratormode.display
 * @ClassName StringDisplay
 * @Description TODO
 * @Date 2023/3/14 16:58
 * @Version 1.0
 */
public class StringDisplay extends Display {

    private String string;

    public StringDisplay(String string) {
        this.string = string;
    }

    @Override
    public int getColumns() {
        return string.length();
    }

    @Override
    public int getRows() {
        return 1;
    }

    @Override
    public String getRowText(int row) {
        if(row > getRows()) {
            return "";
        }
        return string;
    }
}
